home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / lib / mntlib44.zoo / mntlib / purec / setjmp.s < prev    next >
Text File  |  1993-01-30  |  903b  |  43 lines

  1. ; setjmp.s - from the mintlib
  2. ; Pure C version 21-11-92 um
  3.  
  4. ; FPU=0
  5.  
  6.     .text
  7.     .even
  8.     .globl setjmp
  9. setjmp:
  10.     move.l    (sp),(a0)            ; save return address
  11.     movem.l    d3-d7/a2-a7,4(a0)    ; save registers d3-d7/a2-a7
  12. .if FPU
  13.     .mc68881
  14.     fmovem.x fp3-fp7,48(a0)        ; save FPU registers
  15. .endif
  16.     clr.l    d0                    ; return value is 0
  17.     rts
  18.  
  19.     .globl longjmp
  20.     .globl __mint
  21.  
  22. longjmp:
  23.     tst.w    __mint                ; see if MiNT is active
  24.     beq    NOMINT                    ; no -- do not call sigreturn
  25.     move.l    a0,-(sp)
  26.     move.w    d0,-(sp)            ; return value is in d0
  27.     move.w    #$11a,-(sp)            ; Psigreturn() system call
  28.     trap    #1                    ; (ignored if not in a sig handler)
  29.     addq.w    #2,sp
  30.     move.w    (sp)+,d0
  31.     move.l    (sp)+,a0
  32. NOMINT:
  33.     tst.w    d0
  34.     bne    L1                        ; may not be 0
  35.     move.l    #1,d0
  36. L1:
  37.     movem.l    4(a0),d3-d7/a2-a7    ; restore saved reggies
  38. .if FPU
  39.     fmovem.x 48(a0),fp3-fp7
  40. .endif
  41.     move.l    (a0),(sp)            ; and the saved return address
  42.     rts
  43.